package com.demo.kotlin.ui.mine.mvp

import com.demo.kotlin.bean.base.BaseModel
import com.demo.kotlin.bean.user.TokenBean
import com.demo.kotlin.network.BaseNetworkCallBack
import com.demo.kotlin.ui.base.BasePresenter

class LoginPresenter constructor(view: ILoginView) : BasePresenter<ILoginView>(view) {

    fun doLogin(account: String, password: String) {
        startLoading()
        val result = getCommonApiService().login(account, password)
        doSubscribe(result, object : BaseNetworkCallBack<BaseModel<TokenBean>>() {
            override fun onSuccess(body: BaseModel<TokenBean>) {
                stopLoading()
//                getUserInfo(body.data?.token)
            }

            override fun onError(throwable: Throwable, msg: String) {
                stopLoading()
                showToast(msg)
            }
        })
    }

}